<template>
	<view class="page">
		<view class="flex align-center justify-between bg-white text-lg text-bold custom "
			:style="[{height: CustomBar+'px',paddingTop: StatusBar+'px'}]">
			<text class="cuIcon-back padding-left" @click="back"></text>
			<text>信息审核</text>
			<text></text>
		</view>
		<view class="result-info   text-center bg-white padding-tb-xl text-df">
			<view class="result-info-title text-lg">
				<view class="flex flex-direction justify-center align-center check-box" v-if="info.joinin_state == 1">
					<image src="../../static/wait-check.png" mode=""></image>
					<text class="margin-top-sm"> 待认证审核</text>
				</view>
				<!-- <text v-if="info.joinin_state == 2" class="text-333"> 审核通过</text> -->
				<view class="flex flex-direction justify-center align-center check-box" v-if="info.joinin_state == 2">
					<image src="../../static/sh-succ.png" mode=""></image>
					<text class="margin-top-sm"> 审核通过</text>
				</view>
				<view class="flex flex-direction justify-center align-center check-box" v-if="info.joinin_state == 3">
					<image src="../../static/wait-err.png" mode=""></image>
					<text class="margin-top-sm"> 审核失败</text>
				</view>
				<view class="flex flex-direction justify-center align-center check-box" v-if="info.joinin_state == 4">
					<image src="../../static/wait-check.png" mode=""></image>
					<text class="margin-top-sm"> 待财务审核</text>
				</view>
				<view class="flex flex-direction justify-center align-center check-box" v-if="info.joinin_state == 5">
					<image src="../../static/sh-succ.png" mode=""></image>
					<text class="margin-top-sm"> 审核成功</text>
				</view>
				<!-- <text v-if="info.joinin_state == 5" class="text-333"> 财务审核成功</text> -->
				<text v-if="info.joinin_state == 6" class="text-333">审核失败</text>
			</view>
			<!-- <view class="text-666 margin-top-xs" v-if="info.joinin_state == 1 || info.joinin_state == 4 ">信息审核中，请稍等~</view>
		  <view class="text-666 margin-top-xs" v-if="info.joinin_state == 3 || info.joinin_state == 6 ">信息审核失败，请重试~</view> -->
			<view class="btn-wrap flex justify-center margin-top"
				v-if="info.joinin_state == 2 || info.joinin_state == 6">
				<view class="btn" @click="handlerPay"> 去支付</view>
			</view>
			<view class="btn-wrap flex justify-center margin-top" v-if="info.joinin_state == 3">
				<view class="btn" @click="handlerAddInfo">重新提交</view>
			</view>
			<view class="btn-wrap flex justify-center margin-top" v-if="info.joinin_state == 5">
				<view class="btn" @click="handlerLogin">去登录</view>
			</view>
		</view>
		<view class=" " v-if="info.joinin_state == 3 || info.joinin_state == 6 ">
			<view class="padding-lr padding-tb-sm margin-top-sm text-df text-666">
				审核信息
			</view>
			<view class="bg-white text-red  padding text-df">
				<view class="_left" style='margin-bottom: 10rpx'>
					拒绝理由
				</view>
				<view class="_right text-red">
					{{info.reason? info.reason:'无'}}
				</view>
			</view>
		</view>
		<!-- <view class="padding-lr padding-tb-sm margin-top-sm text-df text-666">
      会员信息
    </view>
    <view class="shop-item bg-white height-100 padding-lr text-df flex justify-between align-center solid-bottom">
      <view class="_left">
        会员昵称
      </view>
      <view class="_right text-cut  text-cut  text-right">
        13246533724
      </view>
    </view> -->
		<view class="padding-lr padding-tb-sm margin-top-sm text-df text-666">
			{{info.person.length>0?'个人信息':'企业信息'}}
		</view>
		<view class=" radius-16">
			<view class="shop-item bg-white padding-tb solid-bottom padding-lr text-df flex justify-between align-center "
				v-for="item in info.person" :key="item.name">
				<view class="_left">
					{{item.name}}
				</view>
				<view class="_right text-right" :class="{'image':item.img}">

					<block v-if="item.val">
						{{item.val}}
					</block>
					<image class="img" v-else :src="item.img" mode="heightFix" @click="preview(item.img)"></image>
				</view>
			</view>
			<view class="shop-item bg-white padding-tb solid-bottom padding-lr text-df flex justify-between align-center "
				v-for="item in info.company" :key="item.name">
				<view class="_left">
					{{item.name}}
				</view>
				<view class="_right text-right" :class="{'image':item.img}">

					<block v-if="item.val">
						{{item.val}}
					</block>
					<image class="img" v-else :src="item.img" mode="heightFix" @click="preview(item.img)"></image>
				</view>
			</view>
		</view>
		<view class="padding-lr padding-tb-sm margin-top-sm text-df text-666" v-if="info.pay.length > 0 ">
			支付信息
		</view>
		<view class=" ">
			<view
				class="shop-item bg-white padding-tb solid-bottom padding-lr text-df flex justify-between align-center "
				v-for="item in info.pay" :key="item.name">
				<view class="_left">
					{{item.name}}
				</view>
				<view class="_right text-right" :class="{'image':item.img}">

					<block v-if="item.val">
						{{item.val}}
					</block>
					<image v-else class="img" :src="item.img" mode="heightFix" @click="preview(item.img)"></image>
				</view>
			</view>
		</view>
		<view class="padding-lr padding-tb-sm margin-top-sm text-df text-666" v-if="info.settlement.length>0">
			银行信息
		</view>
		<view class=" ">
			<view
				class="shop-item bg-white padding-tb solid-bottom padding-lr text-df flex justify-between align-center "
				v-for="item in info.settlement" :key="item.name">
				<view class="_left">
					{{item.name}}
				</view>
				<view class="_right text-right" :class="{'image':item.img}">

					<block v-if="item.val">
						{{item.val}}
					</block>
					<image v-else class="img" :src="item.img" mode="heightFix" @click="preview(item.img)"></image>
				</view>
			</view>
		</view>

		<view class="padding-lr padding-tb-sm margin-top-sm text-df text-666">
			店铺信息
		</view>
		<view class=" ">
			<view
				class="shop-item bg-white padding-tb solid-bottom padding-lr text-df flex justify-between align-center "
				v-for="item in info.store" :key="item.name">
				<view class="_left">
					{{item.name}}
				</view>
				<view class="_right text-right" :class="{'image':item.img}">
					<block v-if="item.val">
						{{item.val}}
					</block>
					<image v-else class="img" :src="item.img" mode="heightFix" @click="preview(item.img)"></image>
				</view>
			</view>
		</view>

	</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				info: {
					pay: [],
					company: [],
					person: [],
					licence: '',
					settlement: [],
					store: [],
					reason: '',
				}
			}
		},
		onShow() {
			this.getData();
		},
		onLoad(option) {

			// let pages = getCurrentPages();
			// let prevPage = pages[pages.length - 2]; //上一个页面
			// console.log(JSON.stringify(pages),JSON.stringify(prevPage))
		},
		onPullDownRefresh() {
			this.getData();
			uni.stopPullDownRefresh();
		},
		methods: {
			handlerLogin() {
				uni.reLaunch({
					url: '/pages/user/login/login-password/index'
				})
			},
			preview(url) {
				uni.previewImage({
					current: url,
					urls: [url]
				})
			},
			// 去支付
			handlerPay() {
				uni.navigateTo({
					url: '/pages/user/shop/shop-pay/index'
				})
			},
			// 重填信息
			handlerAddInfo() {
				uni.navigateTo({
					url: '/pages/user/shop/shop-agreement/index'
				})
			},
			onBackPress(e) {
				console.log(e);
				if (e.from == 'backbutton') {
					// this.$util.showModal({
					// 	title:'提示',
					// 	content:'规格尚未保存,确认退出吗?',
					// 	success:res=>{
					// 		console.log(res);
					// 		if(res.confirm){
					// 			uni.navigateBack({
					// 				delta:1
					// 			})
					// 		}
					// 	},
					// 	fail:err=>{
					// 		console.log(err);
					// 	}
					// })
					uni.reLaunch({
						url: '/pages/user/login/login-password/index'
					})
					return true; //阻止默认返回行为
				}
			},
			back() {
				uni.reLaunch({
					url: '/pages/user/login/login-password/index'
				})
			},
			getData() {
				let store_joinin_id = uni.getStorageSync('store_joinin_id') || 0;
				let store_user_id = uni.getStorageSync('store_user_id') || 0;
				this.$api.post('/v1/6103a6e979e56', {}, {
					header: {
						Storeid: store_joinin_id,
						Userid: store_user_id
					}
				}).then(res => {
					console.log(res);
					if (res.data.code == 1) {
						this.info = res.data.data;
					} else {
						this.$message.info(res.data.msg);
					}
				}).catch(err => {
					console.log(err);
				})
			}
		}
	}
</script>

<style scoped lang="scss">
	.page {
		padding-bottom: 120rpx;
	}

	.check-box {
		image {
			width: 178rpx;
			height: 128rpx;
		}
	}

	.result-info {
		border-radius: 16rpx;
	}

	.result-info-title {
		color: #333333;
		font-weight: bold;
		
	}

	.height-100 {
		min-height: 100rpx;
		height: initial;
	}

	.text-bf {
		color: #bfbfbf;
	}

	.shop-item {
		._left {
			width: 240rpx;
		}

		._right {
			width: calc(100% - 240rpx);
			display: flex;
			align-items: center;
			justify-content: flex-end;
			text-align: right;

			&.image {
				padding: 20rpx 0;
			}

			.up-img {
				width: 320rpx;
				height: 150rpx;
				border: 1px dashed #EEEEEE;
				position: relative;

				&::before {
					content: '';
					width: 60rpx;
					height: 4rpx;
					background: #EEEEEE;
					position: absolute;
					top: 50%;
					left: 50%;
					transform: translate(-50%, -50%);
				}

				&::after {
					content: '';
					width: 4rpx;
					height: 60rpx;
					background: #EEEEEE;
					position: absolute;
					top: 50%;
					left: 50%;
					transform: translate(-50%, -50%);
				}
			}

			.img {
				height: 150rpx;
			}

		}
	}

	.btn-wrap {
	  .btn {
	    width: 320rpx;
	    height: 88rpx;
	    line-height: 88rpx;
	    text-align: center;
	    font-size: 28rpx;
	    color: #ffffff;
	    background: $bgtheme;
	    border-radius: 44rpx;
	  }
	
	}

	.custom {
		position: sticky;
		top: 0;
		width: 100%;
		left: 0;
		z-index: 9999;

	}

	.radius-16 {
		border-radius: 16rpx !important;
		overflow: hidden;
	}
</style>
